<include file="public@header" />
</head>
<body>
    <div class="layui-fluid js-check-wrap">
        <div class="layui-card">
            <div class="layui-card-header">
                <h3>{:lang('ADMIN_USER_INDEX')}</h3>
            </div>
            <div class="layui-card-body">
                <form action="{:url('User/user')}" class="form-search layui-form layui-form-item clearfix">
                    <div class="layui-col-md11 layui-col-sm10">
                        <div class="layui-inline">
                            <label class="layui-form-label">用户名:</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="user_login" value="{:input('request.user_login/s','')}" placeholder="请输入{:lang('USERNAME')}">
                            </div>
                        </div>
                        
                        <div class="layui-inline">
                            <input type="submit" class="layui-btn layui-btn-normal" value="搜索" />
                        </div>
                        <div class="layui-inline">
                            <a class="layui-btn layui-btn-danger" href="{:url('User/user')}">清空</a>
                        </div>
                    </div>

                    <div class="layui-col-md1 layui-col-sm2">
                        <a class="layui-btn layui-btn-normal fr" href="{:url('user/update')}">更新用户数据</a>
                    </div>
                </form>
            </div>
            <table class="layui-table">
                <thead>
                    <tr>
                        <th width="50">ID</th>
                        <th>{:lang('USERNAME')}</th>
                        <th>{:lang('ROLE')}</th>
                        <th>{:lang('LAST_LOGIN_IP')}</th>
                        <th>{:lang('LAST_LOGIN_TIME')}</th>
                        <th>{:lang('EMAIL')}</th>
                        <th>{:lang('STATUS')}</th>
                        <th width="150">{:lang('ACTIONS')}</th>
                    </tr>
                </thead>
                <tbody>
                    <php>$user_statuses=array("0"=>lang('USER_STATUS_BLOCKED'),"1"=>lang('USER_STATUS_ACTIVATED'),"2"=>lang('USER_STATUS_UNVERIFIED'));</php>
                    <foreach name="users" item="vo">
                    <tr>
                        <td>{$vo.id}</td>
                        <td><if condition="$vo['user_url']"><a href="{$vo.user_url}" target="_blank" title="{$vo.signature}">{$vo.user_login}</a><else />{$vo.user_login}</if></td>
                        <td>{$vo.name}</td>
                        <td>{$vo.last_login_ip}</td>
                        <td>
                            <if condition="$vo['last_login_time'] eq 0">
                                {:lang('USER_HAVE_NOT_LOGIN')}
                            <else />
                                {:date('Y-m-d H:i:s',$vo['last_login_time'])}
                            </if>
                        </td>
                        <td>{$vo.user_email}</td>
                        <td>{$user_statuses[$vo['user_status']]}</td>
                        <td>
                            <if condition="$vo['id'] eq 1 || $vo['id'] eq cmf_get_current_admin_id()">
                            <button class="layui-btn layui-btn-disabled layui-btn-xs">{:lang('EDIT')}</button>  <button class="layui-btn layui-btn-disabled layui-btn-xs">{:lang('DELETE')}</button>
                                <if condition="$vo['user_status'] eq 1">
                                    <button class="layui-btn layui-btn-disabled layui-btn-xs">{:lang('BLOCK_USER')}</button>
                                <else />
                                    <button class="layui-btn layui-btn-disabled layui-btn-xs">{:lang('ACTIVATE_USER')}</button>
                                </if>
                            <else />
                                <a class="layui-btn layui-btn-xs" href='{:url("user/edit",array("id"=>$vo["id"]))}'>{:lang('EDIT')}</a>
                                <a class="js-ajax-delete layui-btn layui-btn-danger layui-btn-xs" href="{:url('user/delete',array('id'=>$vo['id']))}">{:lang('DELETE')}</a>
                                
                            </if>
                        </td>
                    </tr>
                    </foreach>
                </tbody>
            </table>

            <if condition="$page">
                <div class="pagination-row clearfix">
                    <div class="pages">{$page|default=''}</div>
                </div>
            </if>
        </div>
    </div>
<include file="public@footer" />
